home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13838 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: erich.triumf.ca!bennett
  2. From: bennett@erich.triumf.ca (P.Bennett)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Please help w/seemingly simple problem...
  5. Date: 10 Apr 1996 08:04 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Distribution: world
  8. Message-ID: <10APR199608042663@erich.triumf.ca>
  9. References: <4ke19f$m6r@freenet.vcu.edu>
  10. NNTP-Posting-Host: ftp.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.50    
  12.  
  13. In article <4ke19f$m6r@freenet.vcu.edu>, damurr@freenet.vcu.edu writes...
  14. >/*
  15. >I'm hoping you guys can help me here... I have NO idea what's wrong
  16. >with this code, but I can't get it to display the second screen
  17. >that says, " - Options Menu - ". I can't go any further because it won't
  18. >do anything beyond the first file id screen. The IDE debugger doesn't
  19. >help me at all. 
  20.  
  21. >   #define string "\r"
  22.  
  23. Now, anytime you use 'string' in your  source, it will be replaced by '"\r"'
  24.  
  25. >       scanf(string);
  26. so this becomes scanf("\r");
  27. >    if (string="\r"");
  28. and this becomes if("\r" = "\r");
  29.  
  30. Perhaps you want something like this:
  31.     int ch;
  32.     ch = getch();
  33.     if(ch == '\r')
  34.         ....
  35.  
  36. Note that "\r" is a string of _two_ chars, \r and \0, while '\r' is a single
  37. char.
  38.  
  39. Also, you can't compare strings with '==',  you need to use the strcmp()
  40. function. (and '=' does an assignment, not a comparison)
  41.  
  42.  
  43. Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  44. Internet: bennett@triumf.ca         | of one another only when one can be
  45. Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  46. TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  47. GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  48. or: ftp://ftp-i2.informatik.rwth-aachen.de/pub/arnd/GPS/peter/index.html
  49.  
  50.